import { BoolStrWithBoolen } from '../../Utils/common'
export function familyHistory(data) {
  const {
    attr122,
    attr123,
    attr124,
    attr125,
    attr126,
    attr127,
    attr128,
    attr129,
    attr130,
    attr131,
    attr132,
    attr133,
    attr134,
    attr135,
    attr136,
    attr137,
    attr138,
    attr139,
    attr140,
    attr141,
    attr522,
  } = data
  if (!BoolStrWithBoolen(attr122)) return ''
  let str = ''
  str += attr123to126Convert(attr123, attr124, attr125, attr126)
  str += attr127to130Convert(attr127, attr128, attr129, attr130)
  str += attr131to135Convert(attr131, attr132, attr133, attr134, attr135)
  str += attr136to140Convert(attr136, attr137, attr138, attr139, attr140)
  str += BoolStrWithBoolen(attr141)
    ? '，有家庭成员吸烟'
    : BoolStrWithBoolen(attr141) !== ''
    ? '，没有家庭成员吸烟'
    : ''

  if (attr522) str += `。其他：${attr522}`
  return str
}

function attr123to126Convert(attr123, attr124, attr125, attr126) {
  let str = ''
  if (attr123) str += ',' + attr123
  if (attr124) str += ',' + attr124
  if (attr125) str += ',' + attr125
  if (attr126) str += ',' + attr126
  if (str) str += '有哮喘史。'
  return str
}

function attr127to130Convert(attr127, attr128, attr129, attr130) {
  let str = ''
  if (attr127) str += ',' + attr127
  if (attr128) str += ',' + attr128
  if (attr129) str += ',' + attr129
  if (attr130) str += ',' + attr130
  if (str) str += '有过性鼻炎史。'
  return str
}

function attr131to135Convert(attr131, attr132, attr133, attr134, attr135) {
  let str = ''
  if (attr131) str += ',' + attr131
  if (attr132) str += ',' + attr132
  if (attr133) str += ',' + attr133
  if (attr134) str += ',' + attr134
  if (str) str += '有食物过敏史，'
  if (str && attr135) str += `过敏食物名称：${attr135}。`
  return str
}

function attr136to140Convert(attr136, attr137, attr138, attr139, attr140) {
  let str = ''
  if (attr136) str += ',' + attr136
  if (attr137) str += ',' + attr137
  if (attr138) str += ',' + attr138
  if (attr139) str += ',' + attr139
  if (str) str += '有吸入过敏原致敏史，'
  //要填了前面才需要出来
  if (str && attr140) str += `过敏原名称：${attr140}`
  return str
}
